package org.jeecg.modules.iot.model.control;

import lombok.Data;

/**
 * 泰比特MODBUS智能控制器数据实体类
 */
@Data
public class TaitModbusControllerResponse {

    // 设备ID
    private String deviceId;

    // 软件版本
    private String softwareVersion;

    // 协议版本
    private String protocolVersion;

    // 控制器内部温度
    private float controllerTemperature;

    // 控制器输入电压
    private float controllerInputVoltage;

    // 光伏板电流
    private float pvCurrent;

    // 光伏板电压
    private float pvVoltage;

    // 负载电流
    private float loadCurrent;

    private float loadVoltage;

    // 控制器状态
    private int controllerStatus;

    // 充电电流
    private float chargingCurrent;

    // 充电功率
    private float chargingPower;

    // 放电电流
    private float dischargingCurrent;

    // 放电功率
    private float dischargingPower;

    // 累计充电量
    private float totalChargingCapacity;

    // 累计放电量
    private float totalDischargingCapacity;

    // 控制器累计运行时间
    private int totalRunningTime;

    // 控制器累计故障时间
    private int totalFaultTime;

    // 控制器累计满充满放次数
    private int totalFullChargeDischargeCount;

    // 控制器最大输入电压
    private float maxInputVoltage;

    // 控制器最大输出电流
    private float maxOutputCurrent;

    // 控制器最大输出功率
    private float maxOutputPower;
    //工作模式
    private String workMode;
    //启动模式
    private String startMode;
    //等待时间
    private int throttleOffDelay;
    //锁电机信号
    private String motorLockSignal;
    //动力禁用使能
    private String powerDisable;
    private String speedLimit;
    private int vehicleFaults;
    private boolean hallFault;
    private boolean throttleFault;
    private boolean brakeFault;
    private boolean assistFault;
    private boolean controllerFault;
    private boolean motorFault;
    private boolean underVoltageProtection;
    private boolean overVoltageProtection;
    private boolean overCurrentProtection;
    private boolean buttonFault;
    private boolean tailLightFault;
    private boolean passengerSensorFault;
    private int remainingMileage;
    private boolean passengerDetection;
    private boolean antiFlyProtection;
    private boolean overloadDetection;
    private boolean idleCalibration;
    private boolean stallProtection;
    private boolean motorRunning;
    private boolean brakeActivated;
    private int wheelDiameter;
    private boolean oneClickReturnPressed;
    private int singleTripMileage;
    private int totalBrakeCount;
    private int version;
    private int hallPulseCount;
    private int polePairs;
    private boolean tailLightEnabled;
    private int tailLightBlinkCount;
    private int tailLightOffTime;
    private int tailLightOnTime;
    private boolean batteryLocked;
    private int batteryLockDriveTime;
    private int controllerPower;
    private String batteryLockAction;
    private int batteryVoltageType;
    private int controllerCurrentLimit;
    private boolean softStartEnabled;
    private boolean linkageEnabled;
    private int softStartLevel;
    private int tcsLevel;
    private int hillStartAssistLevel;
    private boolean regenerativeBrakingEnabled;
    private double undervoltageProtectionVoltage;
    private int eabsStrength;
    private int regenerativeBrakingStrength;
    private int regenerativeBrakingSocCondition;
    private boolean nationalStandardSpeedLimit;
    private int parkingToPTime;
    private boolean slopePreventionEnabled;
    private boolean tcsEnabled;
    private int startGear;
    private boolean eabsEnabled;
    private boolean speedLimitEnabled;
    private long totalMileage;
    private int totalBrakeDuration;
    private short gear1Percentage;
    private short gear2Percentage;


    @Override
    public String toString() {
        return "TaitModbusControllerResponse{" +
                "设备ID='" + deviceId + '\'' +
                ", 工作模式='" + workMode + '\'' +
                ", 启动模式='" + startMode + '\'' +
                ", 等待时间=" + throttleOffDelay +
                ", 锁电机信号='" + motorLockSignal + '\'' +
                ", 动力禁用使能='" + powerDisable + '\'' +
                ", 限速='" + speedLimit + '\'' +
                ", 车辆故障=" + vehicleFaults +
                ", 霍尔故障=" + hallFault +
                ", 油门故障=" + throttleFault +
                ", 刹车故障=" + brakeFault +
                ", 助力故障=" + assistFault +
                ", 控制器故障=" + controllerFault +
                ", 电机故障=" + motorFault +
                ", 欠压保护=" + underVoltageProtection +
                ", 过压保护=" + overVoltageProtection +
                ", 过流保护=" + overCurrentProtection +
                ", 按键故障=" + buttonFault +
                ", 尾灯故障=" + tailLightFault +
                ", 乘客传感器故障=" + passengerSensorFault +
                ", 载人检测=" + passengerDetection +
                ", 防飞车保护=" + antiFlyProtection +
                ", 超载检测=" + overloadDetection +
                ", 空车值标定=" + idleCalibration +
                ", 堵转保护=" + stallProtection +
                ", 电机运行=" + motorRunning +
                ", 刹车激活=" + brakeActivated +
                ", 轮径=" + wheelDiameter +
                ", 一键还车按下=" + oneClickReturnPressed +
                ", 单次里程=" + singleTripMileage +
                ", 总刹车次数=" + totalBrakeCount +
                ", 霍尔脉冲计数=" + hallPulseCount +
                ", 极对数=" + polePairs +
                ", 尾灯使能=" + tailLightEnabled +
                ", 尾灯闪烁次数=" + tailLightBlinkCount +
                ", 尾灯灭灯时间=" + tailLightOffTime +
                ", 尾灯亮灯时间=" + tailLightOnTime +
                ", 电池锁=" + batteryLocked +
                ", 电池锁驱动时间=" + batteryLockDriveTime +
                ", 电池锁操作='" + batteryLockAction + '\'' +
                ", 电池电压类型=" + batteryVoltageType +
                ", 控制器限流值=" + controllerCurrentLimit +
                ", 限速使能=" + speedLimitEnabled +
                ", 联动功能=" + linkageEnabled +
                ", EABS使能=" + eabsEnabled +
                ", 停车进入P档时间=" + parkingToPTime +
                ", 防陡坡使能=" + slopePreventionEnabled +
                ", TCS使能=" + tcsEnabled +
                ", 启动档位=" + startGear +
                ", 软启动等级=" + softStartLevel +
                ", 欠压保护电压=" + undervoltageProtectionVoltage +
                ", EABS强度=" + eabsStrength +
                ", 刹车能量回收强度=" + regenerativeBrakingStrength +
                ", 刹车能量回收SOC条件=" + regenerativeBrakingSocCondition +
                ", 国标限速=" + nationalStandardSpeedLimit +
                ", 总里程=" + totalMileage +
                ", 总刹车时长=" + totalBrakeDuration +
                ", 一档速度百分比=" + gear1Percentage +
                ", 二档速度百分比=" + gear2Percentage +
                '}';
    }


    private int[] controllerIdSerialNumber = new int[12];

    // 设置控制器 ID 序列号
    public void setControllerIdSerialNumber(int 索引, int 值) {
        if (索引 >= 0 && 索引 < 12) {
            this.controllerIdSerialNumber[索引] = 值;
        } else {
            // 处理索引超出范围的错误（例如，记录错误消息）
            System.err.println("控制器 ID 序列号索引超出范围: " + 索引);
        }
    }



}